const app = getApp();
// custom-tab-bar/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    currentIndex:0,
    "list": [
      {
        "pagePath": "/pages/recommend/recommend",
        "text": "推荐"
      },
      {
        "pagePath": "/pages/channel/channel",
        "text": "频道"
      },
      {
        "pagePath": "/pages/user/user",
        "text": "个人中心"
      }
    ]
  },
  attached(){
    this.setData({
      currentIndex: app.globalData.currentIndex
    })
  },
  /**
   * 组件的方法列表
   */
  methods: {
    jump(event){
      let path = event.target.dataset.path;
      let index = event.target.dataset.currentindex;
      // console.log(event.target.dataset.currentindex);
      app.globalData.currentIndex =  index;
      // console.log(app);
      wx.switchTab({
        url: path
      })
    }
  }
})
